#!/usr/bin/env bash

#go get -u github.com/gin-gonic/gin
#go mod init hk-video-manager
#go mod tidy
#go mod vendor


# mkdir -p bin/
# if [ -f "bin/hk-channel-manager" ]; then
#     rm -f bin/hk-channel-manager
# fi

# go build -mod=vendor -v -o bin/hk-channel-manager cmd/channel/main.go
# if [ $? -ne 0 ]; then
#     echo "build channel-manager failed"
#     exit 1
# fi
# echo "build channel-manager is ok"
# ./bin/hk-channel-manager




mkdir -p bin/amd64/
if [ -f "bin/amd64/hk-channel-manager" ]; then
    rm -f bin/amd64/hk-channel-manager
fi

export GOOS=linux
export GOARCH=amd64
export CGO_ENABLED=0

go build -mod=vendor -v -o bin/amd64/hk-channel-manager cmd/channel/main.go
if [ $? -ne 0 ]; then
    echo "build channel-manager failed"
    exit 1
fi

echo "build channel-manager is ok"